﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class MoveWithDir : MonoBehaviour {

	// Use this for initialization
	void Start () {
		
	}

	public Vector3 dir = new Vector3(0, 0, 0);
	public float speed = 200f;

	// Update is called once per frame
	void Update () 
	{
		var changePerFrame = speed * dir * Time.deltaTime;
		transform.localPosition += changePerFrame;
		//transform.Translate(speed * dir * Time.deltaTime);

		if(Vector3.Distance(transform.localPosition, Vector3.zero) >= 1000)
		{
			Destroy(gameObject);
		}
	}
}
